"use strict";
cc._RF.push(module, '3e5d4gaiyxFSYw2M7D+dMRw', 'levelFindSpriteClickObj');
// scripts/modes/normalMode/levelFindSprite/base/levelFindSpriteClickObj.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameEngine_1 = require("../../../../engines/gameEngine");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var FindSpriteObjState;
(function (FindSpriteObjState) {
    FindSpriteObjState[FindSpriteObjState["NORMAL"] = 0] = "NORMAL";
    FindSpriteObjState[FindSpriteObjState["CLICK"] = 1] = "CLICK";
})(FindSpriteObjState || (FindSpriteObjState = {}));
var levelFindSpriteClickObj = /** @class */ (function (_super) {
    __extends(levelFindSpriteClickObj, _super);
    function levelFindSpriteClickObj() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.normalSp = null;
        _this.clickSp = null;
        _this.clickShowNode = [];
        _this.nodeState = FindSpriteObjState.NORMAL;
        return _this;
    }
    levelFindSpriteClickObj.prototype.onLoad = function () {
        this.node.on('touchend', this.onTouchEnd, this);
        this.init();
    };
    levelFindSpriteClickObj.prototype.onTouchEnd = function (e) {
        if (this.nodeState == FindSpriteObjState.NORMAL) {
            this.node.off('touchend', this.onTouchEnd, this);
            this.nodeState = FindSpriteObjState.CLICK;
            // O1HD.getManagers().soundMgr.playSound("mainSound/hcy1");
            gameEngine_1.default.getManagers().soundMgr.playVibrate();
            this.onChangeState();
        }
        else {
            this.nodeState = FindSpriteObjState.NORMAL;
            this.onChangeState();
        }
    };
    levelFindSpriteClickObj.prototype.onChangeState = function () {
        if (this.nodeState == FindSpriteObjState.CLICK) {
            this.clickSp.active = true;
            this.normalSp.active = false;
            this.showClickObjs();
        }
        else {
            this.hideClickObjs();
            this.normalSp.active = true;
            this.clickSp.active = false;
        }
    };
    levelFindSpriteClickObj.prototype.init = function () {
        this.onChangeState();
    };
    levelFindSpriteClickObj.prototype.showClickObjs = function () {
        this.clickShowNode.forEach(function (n) {
            n.active = true;
        });
    };
    levelFindSpriteClickObj.prototype.hideClickObjs = function () {
        this.clickShowNode.forEach(function (n) {
            n.active = false;
        });
    };
    __decorate([
        property({ type: cc.Node, displayName: "正常状态下显示的图片" })
    ], levelFindSpriteClickObj.prototype, "normalSp", void 0);
    __decorate([
        property({ type: cc.Node, displayName: "被点击之后显示的图片" })
    ], levelFindSpriteClickObj.prototype, "clickSp", void 0);
    __decorate([
        property({ type: cc.Node, displayName: "非正常状态下需要显示的图片" })
    ], levelFindSpriteClickObj.prototype, "clickShowNode", void 0);
    levelFindSpriteClickObj = __decorate([
        ccclass
    ], levelFindSpriteClickObj);
    return levelFindSpriteClickObj;
}(cc.Component));
exports.default = levelFindSpriteClickObj;

cc._RF.pop();